<link href="./assets/global/plugins/ztree/css/metroStyle/metroStyle.css" rel="stylesheet" type="text/css">
<h3 class="page-title">竞价管理</h3>
<div class="tabbable-custom">
	<div class="portlet">
		<div class="portlet-title">
			<button class="btn btn-success title-action" ng-click="bidGrid.add()"
				tabindex="0">
				<i class="fa fa-plus"></i> 新增竞价
			</button>
			<a href="javascript:void(0);" class="title-operation search-expand">筛选</a>

			<div class="title-search-box">
				<input type="text" placeholder="标题..." class="search-field"
					ng-model="bidGrid.query.quickSearchBidTitle" style="width: 180px;"
					maxlength="100"> <a class="fa fa-search"
					ng-click="bidGrid.query(bidGrid.query.quickSearch = 1)"></a>
			</div>
		</div>
		<div class="portlet-search-body" style="display: none;">
			<form class="form-inline" role="form">
				<div class="form-group">
					<div class="col-md-4">
						<div class="input-icon">
							<i class="fa fa-user"></i> <input class="form-control"
								placeholder="标题" ng-model="bidGrid.query.bidTitle">
						</div>
					</div>
				</div>
				<div class="form-group">
					<div class="col-md-4">
						<div class="input-icon">
							<i class="fa fa-user"></i> <select class="form-control"
								name="status" ng-model="bidGrid.query.status"
								style="width: 200px; color: #b3b3b3;"
								ng-options="opt.value as opt.name for opt in options.bidStatus">
								<option value="">-- 状态 --</option>
							</select>
						</div>
					</div>
				</div>
				<button class="btn btn-primary"
					ng-click="bidGrid.query(bidGrid.query.quickSearch = 0)">
					<i class="fa fa-search"></i> 搜索
				</button>

				<button class="btn btn-primary" ng-click="bidGrid.reset()">
					<i class="fa fa-rotate-left"></i> 重置
				</button>
			</form>
		</div>

		<div class="portlet-body" style="width: 100%">
			<table ed-grid="bidGrid"
				class="table table-striped table-bordered table-hover dataTable"
				ed-url="bid/query.do?" ed-model="bid" style="width: 100%">
				<thead>
					<tr>
						<th ed-data="_index"></th>
						<th ed-data="bidCode">项目编号</th>
						<th ed-data="bidTitle">项目标题</th>
						<!-- <th ed-data="basePrice | number : 2" location="right">起拍价(￥)</th>
						<th ed-data="deposit| number : 2" location="right">保证金(￥)</th>
						<th ed-data="increasePrice| number : 2" location="right">加价幅度(￥)</th> -->
						<th ed-data="publishTime">发布时间</th>
						<th ed-data="limitTime">截止时间</th>
						<!-- <th ed-data="customerName">中标单位</th>
						<th ed-data="winningPrice | number : 2" location="right">中标金额(￥)</th> --> 
						<th ed-data="status | code : 'bidStatus'">状态</th>
						<th width="300px">操作</th>
					</tr>
				</thead>
			</table>
		</div>
	</div>
</div>

<div ed-modal="bidAddModal"
	data-options="width:'950px',title: '竞价信息', static:true,icon: 'fa-user'">
	<div class="tabbable-custom">
		<tabset>
			<tab heading="基本信息" id="basicInfo">
				<div class="tab-content">
					<div>
						<div class="form" style="overflow: auto; height: 540px;">
							<form action="#" class="form-horizontal w5c-form" w5c-form-validate
								novalidate name="bidForm">
								<div class="form-body">
									<div class="form-group">
										<label class="col-md-3 control-label"><span
												class="required">*</span>项目编号</label>

										<div class="col-md-4">
											<input ng-show="!disabledFlag" type="text" class="form-control" name="bidCode"
												   ng-model="bid.bidCode" required>
											<input ng-show="disabledFlag" type="text" class="form-control" name="bidCode2"
												   ng-model="bid.bidCode" disabled>
										</div>
									</div>
									<div class="form-group">
										<label class="col-md-3 control-label"><span
												class="required">*</span>项目标题</label>

										<div class="col-md-4">
											<input ng-show="!disabledFlag" type="text" class="form-control" name="bidName"
												   ng-model="bid.bidTitle" required>
											<input ng-show="disabledFlag" type="text" class="form-control" name="bidName2"
												   ng-model="bid.bidTitle" disabled>
										</div>
									</div>
									<div class="form-group">
										<label class="col-md-3 control-label"><span
												class="required">*</span>保证金(￥)</label>

										<div class="col-md-4">
											<input ng-show="!disabledFlag" type="text" class="form-control" name="deposit" ed-validate="double"
												   ng-model="bid.deposit" required>
											<input ng-show="disabledFlag" type="text" class="form-control" name="deposit2"
												   ng-model="bid.deposit" disabled>
										</div>
									</div>
									<div class="form-group">
										<label class="col-md-3 control-label"><span
												class="required">*</span>起拍价(￥)</label>

										<div class="col-md-4">
											<input ng-show="!disabledFlag" type="text" class="form-control" name="basePrice" ed-validate="double"
												   ng-model="bid.basePrice" required>
											<input ng-show="disabledFlag" type="text" class="form-control" name="basePrice2"
												   ng-model="bid.basePrice" disabled>
										</div>
									</div>
									<div class="form-group">
										<label class="col-md-3 control-label"><span
												class="required">*</span>加价幅度(￥)</label>

										<div class="col-md-4">
											<input ng-show="!disabledFlag" type="text" class="form-control" name="increasePrice" ed-validate="double"
												   ng-model="bid.increasePrice" required>
											<input ng-show="disabledFlag" type="text" class="form-control" name="increasePrice2"
												   ng-model="bid.increasePrice" disabled>
										</div>
									</div>
									<div ng-show="bidEndFlag" class="form-group">
										<label class="col-md-3 control-label"><span
												class="required">*</span>中标单位</label>

										<div class="col-md-4">
											<input  type="text" class="form-control" name="customerName"
													ng-model="bid.customerName" disabled>
										</div>
									</div>
									<div ng-show="bidEndFlag" class="form-group">
										<label class="col-md-3 control-label"><span
												class="required">*</span>中标金额(￥)</label>

										<div class="col-md-4">
											<input  type="text" class="form-control" name="winningPrice"
													ng-model="bid.winningPrice" disabled>
										</div>
									</div>
									<div class="form-group">
										<label class="col-md-3 control-label">竞价须知</label>
										<div class="col-md-4">
											<textarea ng-show="disabledFlag" placeholder="竞价须知" ng-model="bid.bidNotice" name="notice"  rows="10" cols="70" style="height: 120px;" disabled></textarea>
											<textarea ng-show="!disabledFlag" placeholder="竞价须知" ng-model="bid.bidNotice" name="notice2"  rows="10" cols="70" style="height: 120px;"></textarea>
										</div>
									</div>

								</div>
							</form>
						</div>
					</div>
				</div>
			</tab>
			<tab heading="竞价资源">
				<div class="tab-content">
					<div class="portlet" style="height: 20px">
						<div  class="portlet-title"  ng-if="!disabledFlag">
							<button class="btn btn-success title-action"
								ng-click="resourceTree.addBidResource()" tabindex="0">
								<i class="fa fa-plus"></i> 新增资源
							</button>
							<div style="padding: 7px 10px 0px 147px;"><span style="color: red;font-weight:bold;"> 竞价单总金额: {{bidTotalMoney | currency : '￥'}}</span></div>
						</div>
						<div  ng-if="disabledFlag" class="portlet-title">
							<div style="padding: 7px 10px 0px 37px;"><span style="color: red;font-weight:bold;"> 竞价单总金额: {{bidTotalMoney | currency : '￥'}}</span></div>
						</div>
					</div>
					<div class="tabbable-custom" ng-if="mediaTypes.length == 0">
						<div class="portlet" style="height: 420px;">
						<div style="font-size:30px;height: 420px;color:#E8E0E0;border: 3px dotted #E8E0E0;"><div style="text-align:center; width:200px;margin:0 auto;">暂无资源</div></div>
						</div>
					</div>
					<div class="tabbable-custom" ng-if="mediaTypes.length > 0" style="margin-bottom: 5px;">
						<tabset> <tab ng-repeat="media in mediaTypes"
							heading="{{media.mediaName}}" ng-click="resourceInfoOfAddModal.clickTab(media)">
						<div class="tab-content" ng-if="media.parentId == '1'">
							<div class="tab-pane active">
								<div class="portlet" style="height: 405px">
									<div class="portlet-body"
										style="width: 920px; height: 430px; overflow: auto">
										<form action="#" class="form-horizontal w5c-form" w5c-form-validate
												novalidate name="resourceOfBusInfoForm">
											<table
												class="table table-striped table-bordered table-hover dataTable"
												style="border-top: 0px;">
												<thead>
													<tr>
														<th style="text-align: center">线路</th>
														<th style="text-align: center">车牌号</th>
														<th style="text-align: center">资源名称</th>
														<th style="text-align: center;width: 103px;">资源价格(￥)</th>
														<th style="text-align: center; width: 103px;">开始日期</th>
														<th style="text-align: center; width: 103px;">截止日期</th>
														<th ng-if="disabledFlag" style="text-align: center; width: 103px;display:none;">操作</th>
														<th ng-if="!disabledFlag" style="text-align: center; width: 103px;">操作</th>
													</tr>
												</thead>
												<tbody>
													<tr ng-repeat="resource in media.resources">
													<td style="text-align: center; line-height: 33px; padding: 0px;">
														{{resource.lineNo}}
													</td>
													<td style="text-align: center; line-height: 33px; padding: 0px;">
														{{resource.plateNo}}
													</td>
													<td style="text-align: center; line-height: 33px; padding: 0px;">
														<a ng-click="bidGrid.viewResourceSchedule(resource,media.parentId)">{{resource.resourceName}}</a>
													</td>
													<td style="text-align: center; line-height: 33px; padding: 0px;">
														<input ng-if="disabledFlag" type="text" class="form-control"
															   style="height: 25px; border: none; margin-top: 4px;text-align: right;"
															   ng-model="resource.resourcePrice" placeholder="资源价格" disabled title="已发布的竞价单不能修改资源价格"/>
														<input ng-if="!disabledFlag" type="text" class="form-control"
															   style="height: 25px; border: none; margin-top: 4px;text-align: right;" ed-validate="integer"
															   ng-change="resourceInfoOfAddModal.countTotalMoney();"
															   ng-model="resource.resourcePrice" placeholder="资源价格" />
													</td>
													<!-- <td style="text-align: center; padding: 0px;">
														<input ng-if="disabledFlag" type="text" class="form-control" ed-date-picker
															style="height: 25px; border: none; margin-top: 4px;"
															ng-model="resource.startDate" placeholder="开始时间" disabled title="未发布的竞价单才能修改资源"/>
														<input ng-if="!disabledFlag" type="text" class="form-control" ed-date-picker
															style="height: 25px; border: none; margin-top: 4px;" ed-start-date="{{basicDate}}"
															ng-model="resource.startDate" placeholder="开始时间" />
															{{resource.startDate}}
													</td> -->
													<td style="text-align: center; line-height: 33px; padding: 0px;">
														{{resource.startDate}}
													</td>
													<!-- <td style="text-align: center; padding: 0px;">
														<input ng-if="disabledFlag" type="text" class="form-control" ed-date-picker
															style="height: 25px; border: none; margin-top: 4px;"
															ng-model="resource.endDate" placeholder="截止日期"  disabled title="未发布的竞价单才能修改资源"/>
														<input ng-if="!disabledFlag" type="text" class="form-control" ed-date-picker
															style="height: 25px; border: none; margin-top: 4px;"
															ng-model="resource.endDate" placeholder="截止日期" />
															{{resource.endDate}}
														</td> -->
													<td style="text-align: center; line-height: 33px; padding: 0px;">
														{{resource.endDate}}
													</td>
													<td ng-if="disabledFlag" style="text-align: center; line-height: 33px; padding: 0px;display:none" >
														<a ng-click="bidGrid.deleteResource(resource)" >删除</a>
													</td>
													<td ng-if="!disabledFlag" style="text-align: center; line-height: 33px; padding: 0px;" >
														<a ng-click="bidGrid.deleteResource(resource)" disabled>删除</a>
													</td>
												</tr>
												</tbody>

											</table>
										</form>
									</div>
								</div>
							</div>
						</div>

						<div class="tab-content" ng-if="media.parentId == '2'">
							<div class="tab-pane active">
								<div class="portlet" style="height: 475px">
									<div class="portlet-body"
										style="width: 920px; height: 500px; overflow: auto">
										<form action="#" class="form-horizontal w5c-form" w5c-form-validate
							novalidate name="resourceOfStopInfoForm">
										<table
											class="table table-striped table-bordered table-hover dataTable"
											style="border-top: 0px;">
											<tr>
												<th style="text-align: center">站点名称</th>
												<th style="text-align: center">道路名称</th>
												<th style="text-align: center">资源名称</th>
												<th style="text-align: center; width: 103px;">资源价格(￥)</th>
												<th style="text-align: center; width: 103px;">开始日期</th>
												<th style="text-align: center; width: 103px;">截止日期</th>
												<th ng-if="disabledFlag" style="text-align: center; width: 103px;display:none;">操作</th>
												<th ng-if="!disabledFlag" style="text-align: center; width: 103px;">操作</th>
											</tr>
											<tr ng-repeat="resource in media.resources">
												<td style="text-align: center; line-height: 33px; padding: 0px;">
													{{resource.stopName}}
												</td>
												<td style="text-align: center; line-height: 33px; padding: 0px;">
													{{resource.roadName}}
												</td>
												<td
													style="text-align: center; line-height: 33px; padding: 0px;">
													<a ng-click="bidGrid.viewResourceSchedule(resource,media.parentId)">{{resource.resourceName}}</a>
												</td>
												<td style="text-align: center; line-height: 33px; padding: 0px;">
													<input ng-if="disabledFlag" type="text" class="form-control"
														style="height: 25px; border: none; margin-top: 4px;text-align: right;"
														ng-model="resource.resourcePrice" placeholder="资源价格" disabled title="已发布的竞价单不能修改资源价格"/>
													<input  ng-if="!disabledFlag" type="text" class="form-control"
														style="height: 25px; border: none; margin-top: 4px;text-align: right;" ed-validate="integer"
														ng-change="resourceInfoOfAddModal.countTotalMoney();"
														ng-model="resource.resourcePrice" placeholder="资源价格" />
												</td>
												<!-- <td style="text-align: center; padding: 0px;" >
													<input ng-if="disabledFlag" type="text" class="form-control" ed-date-picker
														style="height: 25px; border: none; margin-top: 4px;"
														ng-model="resource.startDate" placeholder="开始时间" disabled title="未发布的竞价单才能修改资源"/>
													<input ng-if="!disabledFlag" type="text" class="form-control" ed-date-picker
														style="height: 25px; border: none; margin-top: 4px;"
														ng-model="resource.startDate" placeholder="开始时间" />
														{{resource.startDate}}
												</td> -->
												<td style="text-align: center; line-height: 33px; padding: 0px;">
													{{resource.startDate}}
												</td>
												<!-- <td style="text-align: center; padding: 0px;">
													<input ng-if="disabledFlag" type="text" class="form-control" ed-date-picker
														style="height: 25px; border: none; margin-top: 4px;"
														ng-model="resource.endDate" placeholder="截止时间" disabled  title="未发布的竞价单才能修改资源"/>
													<input ng-if="!disabledFlag" type="text" class="form-control" ed-date-picker
														style="height: 25px; border: none; margin-top: 4px;"
														ng-model="resource.endDate" placeholder="截止时间" />
												</td> -->
												<td style="text-align: center; line-height: 33px; padding: 0px;">
													{{resource.endDate}}
												</td>
												<td ng-if="disabledFlag" style="text-align: center; line-height: 33px; padding: 0px;display:none" >
													<a ng-click="bidGrid.deleteResource(resource)" >删除</a>
												</td>
												<td ng-if="!disabledFlag" style="text-align: center; line-height: 33px; padding: 0px;" >
													<a ng-click="bidGrid.deleteResource(resource)" disabled>删除</a>
												</td>
											</tr>
										</table>
										</form>
									</div>
								</div>
							</div>
						</div>
						</tab> </tabset>
					</div>
				</div>
			</tab>
		</tabset>
	</div>
</div>

<div ed-modal="bidRecordModal"
	style="height: 550px; min-width: 922px; left: 39%"
	data-options="title: '竞价记录', static:true, icon: 'glyphicon glyphicon-briefcase',
                defaultButton:false">
	<div class="tabbable-custom">
		<div class="portlet" style="height: 420px">
			<!--<div class="portlet-title">
				 <div class="title-search-box">
					<input type="text" placeholder="客户名称..." class="search-field"
						ng-model="bidRecordGrid.query.customerName" style="width: 180px;"
						maxlength="100"> <a class="fa fa-search"
						ng-click="bidRecordGrid.query()"></a>
				</div> 
			</div>-->
			<div class="portlet-body" style="width: 100%">
				<table ed-grid="bidRecordGrid"
					class="table table-striped table-bordered table-hover dataTable"
					ed-url="bid/queryBidRecord.do" ed-model="bidRecord"
					style="width: 99.5%; margin-left: 2px;">
					<thead>
						<tr>
							<th ed-data="_index"></th>
							<th ed-data="customerName">客户名称</th>
							<th ed-data="biddingTime">竞价时间</th>
							<th ed-data="bidPrice | number : 2" location="right">竞价金额(￥)</th>
						</tr>
					</thead>
				</table>
			</div>
		</div>
	</div>
</div>

<div ed-modal="resourceOfAddModal"
	data-options="width:'710px',title: '新增资源', static:true, icon: 'glyphicon glyphicon-briefcase',
                onOkClick : resourceOfAddTrue, onHidden : resourceOfAddCancel">
	<div class="portlet" style="height: 580px">
		<div class="portlet-title">
		<a href="javascript:void(0);" class="title-operation search-expand" style="margin-top: 7px;">筛选</a>
		<form class="form-inline" role="form">
				<div class="form-group">
					<div class="col-md-3">
						<div class="input-icon">
							<i class="fa fa-bus"></i>
							 <select class="form-control"
							 style="font-size: 12px; width: 122px; color: #565353; border: 0px;"
								 ng-model="resourceQuery.resourceParentType"
								 ng-change="resourceTree.parentTypeChange(resourceQuery.resourceParentType)">
								<option value="" >-- 分类 --</option>
								<option value="1">车辆</option>
								<option value="2">站点</option>
							</select>
						</div>
					</div>
				</div> 
				<div class="form-group">
					<div class="col-md-3">
						<div class="input-icon">
							<i class="fa fa-lightbulb-o"></i>
						 <select class="form-control"
						 style="font-size: 12px; width: 150px;color: #565353; border: 0px;"
								 ng-model="resourceQuery.resourceType"
								 ng-change="resourceTree.conditionChange()"
								 ng-options="opt.value as opt.name for opt in resourceTypes">
								<option value="" >-- 媒体类型 --</option>
							</select>
						</div>
					</div>
				</div> 
				<div id="companySelect" class="form-group" style="display: none;">
					<div class="col-md-3">
						<div class="input-icon">
							<i class="fa fa-user "></i>
						 <select class="form-control"
						 style="font-size: 12px; width: 150px;color: #565353; border: 0px;"
								 ng-model="resourceQuery.companyId"
								 ng-change="resourceTree.conditionChange()"
								 ng-options="opt.companyId as opt.companyName for opt in companys">
								<option value="" >-- 营运公司 --</option>
							</select>
						</div>
					</div>
				</div> 
				<button class="btn btn-primary" ng-click="resourceTree.showTreeByResourceType()">
					<i class="fa fa-search"></i> 搜索
				</button>
				</form>
			</div>
			<div class="portlet-search-body" style="display: none;height: 30px;padding-top: 3px; background-color: rgb(249, 243, 243);">
					 <div id="lineDiv" class="title-search-box" style="float: left;margin-left:20px;display: none;">
						<input type="text" placeholder="线路..." class="search-field"
							ng-model="resourceQuery.lineName" style="width: 180px;" maxlength="100">
						<a class="fa fa-search"
							ng-click="resourceTree.showTreeByResourceType();"></a>
					</div> 
					<div id="stopDiv" class="title-search-box" style="float: left;margin-left:20px;display: none;">
						<input type="text" placeholder="站点..." class="search-field"
							ng-model="resourceQuery.stopName" style="width: 180px;" maxlength="100">
						<a class="fa fa-search"
							ng-click="resourceTree.showTreeByResourceType();"></a>
					</div> 
			</div>
			<div class="form" style="overflow: auto; height: 88%;">
				<div class="zTreeDemoBackground left"
					style="padding: 0px 0px 0px 13px;">
					<ul id="treeOfResource" class="ztree"></ul>
				</div>
			</div>
	</div>

</div>
 <div ed-modal="resourceInfoOfAddModal"
	data-options="width:'570px',title: '新增资源信息', static:true, icon: 'glyphicon glyphicon-briefcase'">

	<div class="portlet" style="height: 200px">
		<div class="portlet-title">
			<div class="form" style="overflow: auto; height: 225px;">
				<form action="#" class="form-horizontal w5c-form" w5c-form-validate
					novalidate name="resourceInfoForm">
					<div class="form-body">
						<div class="form-group">
							<label class="col-md-3 control-label"><span
								class="required">*</span>价格</label>

							<div class="col-md-4">
								<input type="text" class="form-control" name="resourcePrice" ed-validate="integer"
									ng-model="resourceInfo.resourcePrice" required>
							</div>
						</div>
						<div class="form-group">
							<label class="col-md-3 control-label"><span
								class="required">*</span>开始时间</label>

							<div class="col-md-4">
								<div class="input-icon">
									<i class="fa fa-calendar"></i> <input type="text"
										class="form-control" name="startDate" ed-date-picker
										ng-model="resourceInfo.startDate" placeholder="开始时间" required />
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="col-md-3 control-label"><span
								class="required">*</span>截止时间</label>

							<div class="col-md-4">
								<div class="input-icon">
									<i class="fa fa-calendar"></i> <input type="text"
										class="form-control" name="endDate" ed-date-picker
										ng-model="resourceInfo.endDate" placeholder="截止时间" required />
								</div>
							</div>
						</div>
						
				</form>
			</div>
		</div>
	</div>
</div> 

<div ed-modal="publishInfoModal"
	data-options="width:'570px',title: '发布信息', static:true, icon: 'glyphicon glyphicon-briefcase'">
	<div class="portlet" style="height: 100px">
		<div class="portlet-title">
			<div class="form" style="overflow: auto; height: 125px;">
				<form action="#" class="form-horizontal w5c-form" w5c-form-validate
					novalidate name="publishInfoForm">
					<div class="form-body">
						<div class="form-group">
							<label class="col-md-3 control-label"><span
								class="required">*</span>发布期限</label>
							<div class="col-md-4">
								<input type="text" class="form-control" name="days" ed-validate="integer"
									ng-model="publishInfo.days" required>
							</div>
						</div>
				</form>
			</div>
		</div>
	</div>
</div> 

<div ed-modal="billResourceScheduleModal"
	data-options="width:'850px',static:true,title: '资源排期明细',
    icon: 'glyphicon glyphicon-briefcase'">
	<div ng-include="'views/bid/bidResource_schedule.html'"
		style="height: 495px;"></div>
</div>

<div ed-modal="depositModal"
	data-options="width:'850px',static:true,title: '保证金',
    icon: 'glyphicon glyphicon-briefcase',defaultButton:false">
	<div ng-include="'views/bid/biddingDeposit.html'" 
		style="height: 590px;"></div>
</div>
